package decoreator

type Compoent interface {
	Calc() int
}
type ConcreteComponet struct{}

func (*ConcreteComponet) Calc() int {
	return 0
}

type MulDecorator struct {
	Compoent
	num int
}

func WarpDecorator(c Compoent, num int) Compoent {
	return &MulDecorator{
		Compoent: c,
		num:      num,
	}
}
func (d *MulDecorator) Calc() int {
	return d.Compoent.Calc() * d.num
}

type AdDecorator struct {
	Compoent
	num int
}

func WarpAddDecorator(c Compoent, num int) Compoent {
	return &AdDecorator{
		Compoent: c,
		num:      num,
	}
}
func (d *AdDecorator) Calc() int {
	return d.Compoent.Calc() + d.num
}
